﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtlantisClientWPF.Bins
{
    public class WorkState
    {
        private readonly Object _Lock = new Object();
        private List<int> takenIDs = new List<int>();

        public List<int> GetTakenIDs()
        {
            lock (_Lock)
            {
                return takenIDs;
            }
        }

        public void UpdateTakenIDs(List<int> addList)
        {
            lock (_Lock)
            {
               // takenIDs = new List<int>();

                for (int i = 0; i < addList.Count; i++)
                {
                    if (!takenIDs.Contains(addList[i]))
                    {
                        takenIDs.Add(addList[i]);
                    }
                }
            }
        }

        public void RemoveTakenIDs(List<int> list)
        {
            lock (_Lock)
            {
                for (int i = 0; i < list.Count; i++)
                    takenIDs.Remove(list[i]);
                
            }
        }
    }
}
